package v1

import (
	"gitee.com/daka1004/devops-runner/constant"
	"gitee.com/daka1004/devops-runner/dto"
	"github.com/gin-gonic/gin"
)

// todo
func (b *BaseApi) Metrics(c *gin.Context) {

	var req dto.RunnerPipeline
	if err := c.ShouldBindJSON(&req); err != nil {
		NewResponse(c).error(constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err).Json()
		return
	}
	req.ExecuteID = c.Param("executeId")
	_, logdata, err := metricsService.Metrics(req)
	if err != nil {
		NewResponse(c).error(constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err).Json()
		return
	}
	NewResponse(c).Success(logdata).Json()
}
